1. Field of Invention
The present invention relates to an optical navigation method, especially an optical navigation method wherein the size of a reference block used for block matching is adjusted according to a motion vector, to thereby increase overall calculation efficiency. The present invention also provides a device using the optical navigation method.
2. Description of Related Art
Optical navigation method is a method of calculating displacements by comparing received images. One of the methods for comparison is block matching. Because it requires a very large amount of calculation to compare one complete image with another complete image, a reference block smaller than the complete image is chosen, and this reference block is compared with all possible locations in a next image (referred to as “fully search”) to calculate a correlation error for every possible location, and a most matching location which corresponds to a matching block is determined. The difference between the coordinate of the matching block at the most matching location and the coordinate of the reference block determines the motion vector of a feature in the images. In the above method, the size of the reference block influences the correlation error calculation; for a reference block having a larger size, the precision for calculating correlation errors is better but the required calculation amount is larger; in contrast, for a reference block having a smaller size, the required calculation amount is less but the precision for calculating correlation errors is lower.
FIG. 1 shows a block matching method according to prior art. Images 11 and 12 are two sequentially captured images, and a reference block 111 is chosen in the image 11. In this example, it is assumed that the image 11 has a size of 6×6, and the chosen reference block has a size of 4×4. The 4×4 reference block is compared with all possible matching locations in the image 12, that is, the upper left corner of the reference block 111 (shown as a black dot in the image 11) may be located at nine possible locations (shown as the hollow dots) in the image 12. The nine possible matching locations are examined by correlation error calculations, and a most matching block 121 corresponding to the reference block 111 is determined because it has the smallest correlation error. The correlation error can be calculated by any known method, such as by block average, feature area, difference between adjacent pixels, etc. After determining the matching block 121, the coordinate of the matching block 121 is compared with the coordinate of the reference block 111 to determine a motion vector; in the X, Y coordinate system shown in the figure, the (X displacement, Y displacement) is illustrated as (−1, 1). The original reference block 111 has moved to a new location, i.e., the reference block 123, so a new reference block 124 is chosen in the image 12, and the aforementioned steps are repeated for calculating the next motion vector.
In the aforementioned prior art, the size of the reference block is fixed, and therefore the calculation efficiency and the precision can not be both optimized. Furthermore, the reference block needs to be frequently updated, which greatly increases the calculation loading. In view of these drawbacks, the present invention provides an optical navigation method which compares two images to generate a motion vector and adjusts the size of the reference block according to the motion vector, and preferably adjusts an area for block matching comparison according to the motion vector, to increase the efficiency of comparison and overall calculation, while maintaining the precision of comparison and calculation.